// src/app.js
import React, { Suspense } from "react";
import { Route, Routes, Link } from "react-router-dom";
import routes from "@/routes/route.jsx";

const AppRoutes = () => {
  return (
    <Suspense fallback={<div>Loading...</div>}>
      <Routes>
        {routes.map((route, index) => (
          <Route key={index} path={route.path} element={route.component} />
        ))}
      </Routes>
    </Suspense>
  );
};

export default function App () {
  return (
    <div>
      <nav>
        <ul>
          <li>
            <Link to="/">Home</Link>
          </li>
          <li>
            <Link to="/page">Page</Link>
          </li>
        </ul>
      </nav>
      <AppRoutes />
    </div>
  );
}
